#include "framemoviejob.h"

#include <jobs/kdcstandardkprocessjob.h>

#include <interfaces/kdcapplicationinterface.h>
extern KDCApplicationInterface *gAppInterface;

FrameMovieJob::FrameMovieJob( const QPixmap &aInput, QObject *aParent ) : KDCFrameJobInterface( aParent )
{
	aInput.save( pDir.name() + "/out.png", "png" );
	KDCStandardKProcessJob *job = new KDCStandardKProcessJob( this );
	job->setProgram( "montage" );
	job->setWorkingDirectory( pDir.name() );
	job->addArgument( gAppInterface->applicationDataDir() + "/frames/top.png" );
	job->addArgument( "out.png" );
	job->addArgument( gAppInterface->applicationDataDir() + "/frames/bottom.png" );
	job->addArgument( "-background", "none" );
	job->addArgument( "-mode", "Concatenate" );
	job->addArgument( "-tile", "1x" );
	job->setOutputFile( "out.png" );
	addSubjob( job );
}

FrameMovieJob::~FrameMovieJob()
{

}

QPixmap FrameMovieJob::resultFrame() const
{
	return QPixmap( pDir.name() + "/out.png" );
}
